#include <iostream>
#include <thread>

using std::cout;
using std::endl;
using std::thread;

void threadFunc(int x)
{
    cout << "child thread x = " << x << endl;
    cout << "child thread id = " 
        << std::this_thread::get_id() << endl;
}

int main(int argc, char *argv[])
{
    cout << "main thread id = " 
        << std::this_thread::get_id() << endl;

    typedef void (&pFunc)(int);//函数引用的定义方式
    pFunc f = threadFunc;
    thread th(f, 3);

    th.join();//主线程main等待子线程的执行

    return 0;
}

